class Solution:
    def removeDuplicates(self, nums):
        if not nums:
            return 0

        n = len(nums)
        fast = slow = 1
        while fast < n:
            if nums[fast] != nums[fast - 1]:
                nums[slow] = nums[fast]
                slow += 1
            fast += 1

        return slow

if __name__ == '__main__':
    so = Solution()

    res = so.removeDuplicates([1,1,2])
    print(res)
